home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / k3bchecksumpipe.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  1.4 KB  |  67 lines

  1. /* 
  2.  *
  3.  * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $
  4.  * Copyright (C) 2006 Sebastian Trueg <trueg@k3b.org>
  5.  *
  6.  * This file is part of the K3b project.
  7.  * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  * See the file "COPYING" for the exact licensing terms.
  14.  */
  15.  
  16. #ifndef _K3B_CHECKSUM_PIPE_H_
  17. #define _K3B_CHECKSUM_PIPE_H_
  18.  
  19. #include <k3bactivepipe.h>
  20.  
  21. #include <k3b_export.h>
  22.  
  23.  
  24. /**
  25.  * The checksum pipe calculates the checksum of the data
  26.  * passed through it.
  27.  */
  28. class LIBK3B_EXPORT K3bChecksumPipe : public K3bActivePipe
  29. {
  30.  public:
  31.   K3bChecksumPipe();
  32.   ~K3bChecksumPipe();
  33.  
  34.   enum Type {
  35.     MD5
  36.   };
  37.  
  38.   /**
  39.    * \reimplemented
  40.    * Defaults to MD5 checksum
  41.    */
  42.   bool open( bool closeWhenDone = false );
  43.  
  44.   /**
  45.    * Opens the pipe and thus starts the 
  46.    * checksum calculation
  47.    *
  48.    * \param closeWhenDone If true the pipes will be closed
  49.    *        once all data has been read.
  50.    */
  51.   bool open( Type type, bool closeWhenDone = false );
  52.  
  53.   /**
  54.    * Get the calculated checksum
  55.    */
  56.   QCString checksum() const;
  57.  
  58.  protected:
  59.   int write( char* data, int max );
  60.  
  61.  private:
  62.   class Private;
  63.   Private* d;
  64. };
  65.  
  66. #endif
  67.